
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
 */
package myframework;

//~--- non-JDK imports --------------------------------------------------------

import nac.firefight.FireFightGame;
import org.newdawn.slick.AngelCodeFont;
import org.newdawn.slick.Font;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.gui.AbstractComponent;
import org.newdawn.slick.gui.ComponentListener;
import org.newdawn.slick.gui.TextField;
import org.newdawn.slick.state.StateBasedGame;

/**
 *
 * @author User
 */
public class TestPassiveGameState extends PassiveGameState implements ComponentListener {
    TextField field;
    Font      font;
    String    message;

    public TestPassiveGameState(int id, FireFightGame ffg) {
        super(id, ffg);
    }

    public void init(GameContainer container, StateBasedGame game) throws SlickException {
        font  = new AngelCodeFont("testdata/demo2.fnt", "testdata/demo2_00.tga");
        field = new TextField(container, font, 150, 20, 500, 35, new ComponentListener() {
            public void componentActivated(AbstractComponent source) {
                message = "Entered1: " + field.getText();
            }
        });
        addComponent(field);
    }

    @Override
    protected void postRender(GameContainer container, StateBasedGame game, Graphics g) {
        g.setFont(font);
        if(message != null){
        g.drawString(message, 400, 550);
        }
    }

    public void componentActivated(AbstractComponent source) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
